
#include "GeosphereVert.h"

// Need to do this outside of header to avoid cyclic dependency
#include "GeosphereFace.h"


/*--------------------------------------------------------------------*/
GeosphereVert::GeosphereVert() {
	flag = false;
}

/*--------------------------------------------------------------------*/
void GeosphereVert::calcUnit() {
	unit = normalize(vert);
}

/*--------------------------------------------------------------------*/
void GeosphereVert::calcNorm() {			
	//if ( adjFaces.empty() ) { norm = unit; return; }
	
	vec3f faceNormSum = vec3f(0,0,0);

	list<GeosphereFace*>::iterator i;
	for ( i = adjFaces.begin() ; i != adjFaces.end() ; ++i ) {
		faceNormSum = addVec( faceNormSum, *((*i)->getFaceNorm()) );
	}

	norm = normalize( faceNormSum );
}
